package com.jgsu.farm.mapper.provider;

import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.jdbc.SQL;

/**
 * @program: farm-10-14-2019
 * @description: 专家用户的动态SQL
 * @author: Mr.zuo
 * @create: 2019-12-08 12:25
 **/
@Slf4j
public class ExpertProvider {
    public String findExpertListByState(final Integer state) {
        return new SQL() {
            {
                SELECT("*");
                FROM("user");
                WHERE("role = #{role}");
                if (state != null) {
                    WHERE("state = #{state}");
                }
                ORDER_BY("userid");
            }
        }.toString();
    }
}
